import {baseUrl, API_ROOT} from './baseUrl';
// let url = "http://192.168.1.218:8080/devicemonitor-rest"
let url = "http://222.178.152.37:8081";

let zsUrl = "http://192.168.1.100";
// let zsUrl   = "http://192.168.1.178:8080";
let zsUrlSb = "http://192.168.1.178:8081"; //设备
// let zsUrl = "http://222.178.152.37:8081";
export default {
    //大屏数据管理
    dataAdmin(context, select) {
        context.$http.get('' + url + '/screen/v1/debug/device_room/').then(
            // context.$http.get(baseUrl+"/static/data/screenLook/dataAdmin.json").then(
            function (response) {
                let res = response.data;
                context.listSelect = res;
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < res.length; i++) {
                    if (select == res[i].dev_room_name) {
                        context.list = res[i].para_list;
                        //console.log(JSON.stringify(context.list));
                    }
                }
            }
        )
    },

    refresh: function (context) {
        context.$http.put('' + url + '/screen/v1/debug/dev_data_manager/reset').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                setTimeout(function () {
                    context.$router.go()
                }, 500)

            }
        )
    },

    //
    jcbjAdmin(context, id, select) {
        context.$http.put('' + url + '/screen/v1/debug/collect_para/' + id + '/unalarm').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(context.list))
                for (var i = 0; i < res.length; i++) {
                    if (select == res[i].dev_room_name) {
                        context.list = res[i].para_list;
                        //console.log(JSON.stringify(context.list))
                    }
                }
            }
        )
    },

    szbjAdmin(context, id, val, select) {
        context.$http.put('' + url + '/screen/v1/debug/collect_para/' + id + '?dev_para_val=' + val + '').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));

                for (var i = 0; i < res.length; i++) {
                    if (select == res[i].dev_room_name) {
                        context.list = res[i].para_list;
                        //console.log(JSON.stringify(context.list))
                    }
                }

            }
        )
    },

    //侧边导航
    sliderNav(context) {
        context.$http.get(baseUrl + "/static/data/sliderNav.json").then(
            function (response) {
                let res = response.data;
                if (res.status == "ok") {
                    context.list = res.datas;
                }
                else {
                    alert(res.message)
                }
            }
        )
    },

    //平台设置-小区管理
    xqglNowPag(context, pageArr) {

        context.$http.get(zsUrl + "/uc/v1/mgt/area", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;
                //console.log(pageArr.page_num)
                context.currentPage = pageArr.page_num;
                context.loading = true;

            }
        )
    },


    deleteXqData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/area', {params: arrId}).then(
            //context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area",{params:pageArr}).then(
            function (response) {
                let res = response.data;
            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/area", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.loading = true;
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });
                    }
                )
            }
        )
    },

    addXqData(context, dataArr, Tips) {
        context.$http.post(zsUrl + '/uc/v1/mgt/area/', dataArr).then(
            function (response) {
                let res = response.data;
                context.$router.push({path: '/xqgl'});
            }
        )
    },

    modifyXqData(context, dataArr, Tips, area_id) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/area/' + area_id + '', dataArr).then(
            function (response) {
                let res = response.data;
                context.$router.push({path: '/xqgl'});
            }
        )
    },

    getModifyXqgl(context, area_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/area/' + area_id + '').then(
            function (response) {
                let res = response.data;
                context.selected = res.district_info.id;
                context.district_id = res.district_info.id;

                context.area_name = res.area_name;
                context.area_no = res.area_no;
                context.area_address = res.area_address;
                context.access_date = res.access_date;
                context.floor_space = res.floor_space;
                context.total_floor_space = res.total_floor_space;
                context.plot_ratio = res.plot_ratio;
                context.greening_ratio = res.greening_ratio;
                context.extra_desc = res.extra_desc;

                //console.log(JSON.stringify(res))
            }
        )
    },


    //平台设置-小区管理-楼栋管理
    ldgl(context) {
        context.$http.get(zsUrl + "/uc/v1/mgt/building").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.loading = true;
            }
        )
    },

    getModifyLdgl(context, cell_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/building/' + cell_id + '').then(
            function (response) {
                let res = response.data;
                context.buildingl_name = res.cell_name;
                context.building_no = res.cell_no;

                context.selected = res.district_info.id;
                context.district_id = res.district_info.id;
                context.selectedXq = res.area_info.id;
                context.area_id = res.area_info.id;


                context.building_id = res.building_infor.id;
                context.selectedLd = res.building_infor.id;
                context.extra_desc = res.extra_desc;

            }
        )
    },

    //平台设置-楼层管理
    dyglNowPag(context, pageArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/cell", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
            }
        )
    },

    getXq(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/area", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.xqList = res.rows;
                console.log(JSON.stringify(res.rows))
            }
        )
    },
    getLd(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/building", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.ldList = res.rows;
                console.log(JSON.stringify(res.rows))
            }
        )
    },
    getDy(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/cell", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.dyList = res.rows;
                console.log(JSON.stringify(res.rows))
            }
        )
    },
    getLc(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/floor", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.lcList = res.rows;
                console.log(JSON.stringify(res.rows))
            }
        )
    },
    getFj(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/room", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.lcList = res.rows;
                console.log(JSON.stringify(res.rows))
            }
        )
    },
    getDyglId(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/cell", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.dydlistid = res.rows;
                //console.log(JSON.stringify(context.xqdlist))
            }
        )
    },


    //平台设置-单元管理
    ldglNowPag(context, pageArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/building", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;
                context.currentPage = pageArr.page_num
                context.loading = true;
            }
        )
    },

    addLdData(context, dataArr, Tips) {
        context.$http.post(zsUrl + '/uc/v1/mgt/building/', dataArr).then(
            function (response) {
                context.$router.push({path: '/ldgl'});
            }
        )
    },

    getModifyLdgl(context, area_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/building/' + area_id + '').then(
            function (response) {
                let res = response.data;
                context.building_name = res.building_name;
                context.building_no = res.building_no;
                context.building_type = res.building_type;
                context.selectedYt = res.building_type;
                context.extra_desc = res.extra_desc;

                console.log(JSON.stringify(res))
            }
        )
    },

    modifyLdData(context, dataArr, Tips, building_id) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/building/' + building_id + '', dataArr).then(
            function (response) {
                let res = response.data;
                context.$router.push({path: '/ldgl'});

            }
        )

    },

    deleteLdData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/building', {params: arrId}).then(
            function (response) {
                let res = response.data;

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/building", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        console.log(JSON.stringify(res))
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);
                        context.loading = true;


                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    //平台设置-小区管理-单元管理
    dygl(context) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(zsUrl + "/uc/v1/mgt/cell").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.loading = true;
            }
        )
    },

    getModifyDygl(context, cell_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/cell/' + cell_id + '').then(
            function (response) {
                let res = response.data;
                context.cell_name = res.cell_name;
                context.cell_no = res.cell_no;
                context.selected = res.district_info.id;
                context.district_id = res.district_info.id;
                context.selectedXq = res.area_infor.id;
                context.district_id = res.area_infor.id;
                context.selectedLd = res.building_inofr.id;
                context.building_id = res.building_inofr.id;
                context.extra_desc = res.extra_desc;

            }
        )
    },

    //平台设置-单元管理
    dyglNowPag(context, pageArr) {

        context.$http.get(zsUrl + "/uc/v1/mgt/cell", {params: pageArr}).then(
            //context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area",{params:pageArr}).then(
            function (response) {

                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num
                context.loading = true;


            }
        )
    },

    addDyData(context, dataArr, Tips) {
        context.$http.post(zsUrl + '/uc/v1/mgt/cell/', dataArr).then(
            function (response) {
                context.$router.push({path: '/dygl'});
            }
        )
    },

    modifyDyData(context, index, id, Tips, dataArr, pageArr) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/cell/' + id + '', dataArr).then(
            function (response) {
                let res = response.data;
                context.$router.push({path: '/dygl'});

            }
        )
    },

    deleteDyData(context, index, Tips, pageArr, arrId) {

        context.$http.delete(zsUrl + '/uc/v1/mgt/cell', {params: arrId}).then(
            function (response) {
                let res = response.data;

                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                context.arrId = [];
            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/cell", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        //console.log(JSON.stringify(res.rows))
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);

                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }


                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;

                        }
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i
                        }
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    getLcgl(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/cell", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.dydlistid = res.rows;
                //console.log(JSON.stringify(res.rows))
            }
        )
    },

    //平台设置-小区管理-楼层管理
    lcgl(context) {
        context.$http.get(zsUrl + "/uc/v1/mgt/floor").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res.rows));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                context.loading = true;
            }
        )
    },

    getModifyLcgl(context, floor_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/floor/' + floor_id + '').then(
            function (response) {
                let res = response.data;
                context.floor_name = res.floor_name;
                context.floor_no = res.floor_no;
                context.selected = res.district_info.id;
                context.district_id = res.district_info.id;
                context.selectedXq = res.area_infor.id;
                context.district_id = res.area_infor.id;
                context.selectedLd = res.building_inofr.id;
                context.building_id = res.building_inofr.id;
                context.selectedDy = res.cell_inofr.id;
                context.cell_id = res.cell_inofr.id;
                context.extra_desc = res.extra_desc;

            }
        )
    },
    //平台设置-楼层管理
    lcglNowPag(context, pageArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/floor", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num

            }
        )
    },

    addLcData(context, dataArr, Tips, pageArr) {
        context.$http.post(zsUrl + '/uc/v1/mgt/floor/', dataArr).then(
            function (response) {
                let res = response.data;

                context.$router.push({path: '/lcgl'});

            }
        )
    },

    getLcData(context, id) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/floor/' + id + '').then(
            function (response) {
                let res = response.data;
                console.log(JSON.stringify(res))
                context.floor_name = res.floor_name;
                context.cell_id = res.cell_info.id;
                context.building_id = res.building_info.id;
                context.selected = res.cell_info.id;
                context.selectedLd = res.building_info.id;
                context.floor_no = res.floor_no;
                context.extra_desc = res.extra_desc;

            }
        )
    },

    modifyLcData(context, index, id, Tips, dataArr, pageArr) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/floor/' + id + '', dataArr).then(
            function (response) {
                let res = response.data;
                context.$router.push({path: '/lcgl'});
            }
        )
    },

    deleteLcData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/floor', {params: arrId}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/floor", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        //console.log(JSON.stringify(res.rows))
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);

                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }


                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;

                        }
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i
                        }
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    getFjgl(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/floor", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.lcdlist = res.rows;
                //console.log(JSON.stringify(res.rows))
            }
        )
    },
    getXqgl(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/room", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.xqdlista = res.rows;
                //console.log(JSON.stringify(res))
            }
        )
    },
    //平台设置-小区管理-楼层管理
    fjgl(context) {
        context.$http.get(zsUrl + "/uc/v1/mgt/room").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res.rows));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                context.loading = true;
            },
            function () {
                context.loading = true;
            }
        )
    },

    getModifyLcgl(context, room_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/room/' + room_id + '').then(
            function (response) {
                let res = response.data;
                context.floor_name = res.floor_name;
                context.floor_no = res.floor_no;
                context.selected = res.district_info.id;
                context.district_id = res.district_info.id;
                context.selectedXq = res.area_infor.id;
                context.district_id = res.area_infor.id;
                context.selectedLd = res.building_inofr.id;
                context.building_id = res.building_inofr.id;
                context.selectedDy = res.cell_inofr.id;
                context.cell_id = res.cell_inofr.id;
                context.selectedLc = res.floor_inofr.id;
                context.floor_id = res.floor_inofr.id;
                context.extra_desc = res.extra_desc;

            }
        )
    },
    //平台设置-楼层管理
    fjglNowPag(context, pageArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/room", {params: pageArr}).then(
            function (response) {
                let res = response.data;

                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num
                context.loading = false;
            }
        )
    },

    addFjData(context, dataArr, Tips, pageArr) {
        context.$http.post(zsUrl + '/uc/v1/mgt/room/', dataArr).then
        (
            function (response) {
                let res = response.data;

                context.$router.push({path: '/fjgl'});
            }
        )
    },

    modifyFjData(context, index, id, Tips, dataArr, pageArr) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/room/' + id + '', dataArr).then
        (
            function (response) {
                let res = response.data;
                context.$router.push({path: '/fjgl'});

            }
        )
    },

    deleteFjData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/room', {params: arrId}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);


            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/room", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);

                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }
                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        //console.log(context.pageNum)
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i;

                            //console.log(context.page[i])
                        }
                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    //平台设置-用户管理
    yhgl(context) {
        context.$http.get(zsUrl + "/uc/v1/mgt/resident").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                this.loading = true;

            }
        )
    },

    yhglNowPag(context, pageArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/resident", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;
                context.currentPage = pageArr.page_num
                context.loading = true;
            }
        )
    },

    addFYh(context, dataArr, Tips) {
        context.$http.post(zsUrl + "/uc/v1/mgt/resident", dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "添加成功",
                    class: "on"
                });
                context.$router.push({path: '/yhgl'})
            },
            function (err) {
                alert(err.body.error_msg)
            }
        )
    },

    addModifyYh(context, dataArr, Tips, user_id) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/resident/' + user_id + '', dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
                context.$router.push({path: '/yhgl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    getModifyYhgl(context, staff_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/resident/' + staff_id + '').then(
            function (response) {
                let res = response.data
                console.log(JSON.stringify(res))

                context.user_name = res.user_name;
                context.selectedLx = res.resident_type;
                context.resident_type = res.resident_type;
                context.sex = res.sex;
                context.card_no = res.card_no;
                context.phone = res.phone;
                context.nickname = res.nickname;
                context.birthday = res.birthday;
                context.nation = res.nation;
                context.address = res.address;
                context.household_address = res.household_address;

                context.extra_desc = res.extra_desc;
                context.company = res.company;
                for (var i = 0; i < res.room_infos.length; i++) {
                    context.fjList.push(res.room_infos[i].name);
                    context.room_ids.push(res.room_infos[i].id);
                }
            }
        )
    },

    //平台设置-用户管理
    getYhInfor(context, lookObj) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(zsUrl + '/uc/v1/mgt/resident/' + lookObj.user_id + '').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                context.lookObj = res;

            }
        )
    },

    deleteYhData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/resident', {params: arrId}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/resident", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;

                        context.page_size = res.page_size;
                        context.page_num = res.page_num;

                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }

                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    addYhData(context, dataArr, Tips, pageArr) {
        context.$http.post(zsUrl + '/uc/v1/mgt/resident', dataArr).then(
            function (response) {
                let res = response.data;

                context.id = res.data_id;

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/resident", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        //console.log(JSON.stringify(res.rows))
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);

                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }

                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;

                        }
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i
                        }
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "添加成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    modifyYhData(context, index, id, Tips, dataArr, pageArr) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/resident/' + id + '', dataArr).then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/resident", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);
                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }
                        if (context.total == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i;
                        }
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "修改成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },


    getzc(context, dataArr) {
        context.$http.get(zsUrl + '/uc/v1/mgt/dept/' + 0 + '/node', {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.bmList = res;
                console.log(JSON.stringify(res))
            }
        )
    },


    //平台设置-员工管理
    yggl(context) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(zsUrl + "/uc/v1/mgt/staff").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                context.loading = true;
            }
        )
    },

    addFYg(context, dataArr, Tips) {
        context.$http.post(zsUrl + "/uc/v1/mgt/staff", dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "添加成功",
                    class: "on"
                });
                context.$router.push({path: '/yggl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    addModifyYg(context, dataArr, Tips, staff_id) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/staff/' + staff_id + '', dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
                context.$router.push({path: '/yggl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    getModifyYggl(context, staff_id) {
        context.$http.get(zsUrl + '/uc/v1/mgt/staff/' + staff_id + '').then(
            function (response) {
                context.listObj = response.data;
                context.selectedZt = context.listObj.staff_status;
                context.staff_status = context.listObj.staff_status;
                context.role_info = context.listObj.role_info;
                context.dept_info = context.listObj.dept_info;
                context.selected = context.listObj.role_info.id;
                context.dept_id = context.listObj.dept_info.id;
                context.dept_name = context.listObj.dept_info.name;
                context.role_id = context.listObj.role_info.id;


                context.user_name = context.listObj.user_name;
                context.card_no = context.listObj.card_no;
                context.job_no = context.listObj.job_no;
                context.birthday = context.listObj.birthday;
                context.nation = context.listObj.nation;
                context.duty_area = context.listObj.duty_area;
                context.card_no = context.listObj.card_no;
                context.phone = context.listObj.phone;
                context.address = context.listObj.address;
                context.household_address = context.listObj.household_address;
                context.is_leader = context.listObj.is_leader;
                context.induction_date = context.listObj.induction_date;
                context.positive_date = context.listObj.positive_date;
                context.leave_date = context.listObj.leave_date;
                context.extra_desc = context.listObj.extra_desc;
                context.sex = context.listObj.sex;
                context.birthday = context.listObj.birthday;
                console.log(JSON.stringify(context.listObj))
            }
        )
    },

    getRoleList(context) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(zsUrl + "/uc/v1/mgt/role").then(
            function (response) {
                let res = response.data;
                context.roleList = res.rows;
            }
        )
    },

    //平台设置-用户管理
    getYgInfor(context, lookObj) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(zsUrl + '/uc/v1/mgt/staff/' + lookObj.staff_id + '').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                context.lookObj = res;
                context.roleInfo = res.role_info.name;
                context.deptInfo = res.dept_info.name;
            }
        )
    },

    ygglNowPag(context, pageArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/staff", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;
                context.currentPage = pageArr.page_num
                context.loading = true;
            }
        )
    },


    deleteYgData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/staff', {params: arrId}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/staff", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);

                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }
                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        //console.log(context.pageNum)
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i;

                            //console.log(context.page[i])
                        }
                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    addYgData(context, dataArr, Tips, pageArr) {
        context.$http.post(zsUrl + '/uc/v1/mgt/staff/', dataArr).then(
            function (response) {
                let res = response.data;

                context.id = res.data_id;

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/staff", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        //console.log(JSON.stringify(res.rows))
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);

                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }

                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i
                        }
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "添加成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    modifyYgData(context, index, id, Tips, dataArr, pageArr) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/staff/' + id + '', dataArr).then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/staff", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);

                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }
                        if (context.total == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i;
                        }
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "修改成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },


    //平台设置-组织管理
    zcgl(context) {
        context.$http.get(baseUrl + "/static/data/ptsettings/zzgl/zzgl.json").then(
            function (response) {
                let res = response.data;

                context.list = res;

                context.topName = context.list[context.topNum];
                context.pqList = context.topName.children[context.topNum].children;
                //console.log(JSON.stringify(context.pqList))
                context.xqList = context.pqList[context.pqNum].children;
                context.deptList = context.xqList[context.xqNum].children;

            }
        )
    },

    removeZz(context, id, Tips) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/dept/' + id + '').then(
            function (response) {
                let res = response.data;
                // localStorage.removeItem("data_id");
                // localStorage.removeItem("parent_id");
                // console.log(JSON.stringify(context.treeData));
                //let tree = JSON.parse(localStorage.getItem("parentArr"));

                if (context.treeData[0].dept_id == id) { //一级删除
                    context.treeData.splice(0, 1);
                    // tree.splice(i, 1);
                    context.dept_id = null;
                    context.pid = null;
                    localStorage.removeItem("parentArr");
                    localStorage.removeItem("data_id");
                    localStorage.removeItem("parent_id");
                    this.notTree = false;
                    this.notDiv = true;
                }
                if (context.treeData[0].length != 0) { //二级删除
                    for (var a = 0; a < context.treeData[0].children.length; a++) { //二级
                        if (context.treeData[0].children[a].dept_id == id) {
                            context.treeData[0].children.splice(a, 1);
                            if (context.treeData[0].children.length == 0) {
                                delete context.treeData[0].children;
                            }
                            context.treeData = JSON.parse(JSON.stringify(context.treeData))
                            localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                        }
                        if (context.treeData[0].children[a]) { //三级删除
                            for (var b = 0; b < context.treeData[0].children[a].children.length; b++) {
                                if (context.treeData[0].children[a].children[b].dept_id == id) {
                                    if (context.treeData[0].children[a].children.length == 0) {
                                        delete context.treeData[0].children[a].children;
                                    }
                                    context.treeData[0].children[a].children.splice(b, 1);
                                    context.treeData = JSON.parse(JSON.stringify(context.treeData))
                                    localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                                }

                                if (context.treeData[0].children[a].children[b]) { //四级删除
                                    for (var c = 0; b < context.treeData[0].children[a].children[b].children.length; c++) { //二级
                                        if (context.treeData[0].children[a].children[b].children[c].dept_id == id) {
                                            if (context.treeData[0].children[a].children[b].children.length == 0) {
                                                delete context.treeData[0].children[a].children[b].children;
                                            }
                                            context.treeData[0].children[a].children[b].children.splice(c, 1);
                                            context.treeData = JSON.parse(JSON.stringify(context.treeData))
                                            localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                                        }


                                    }
                                }


                            }
                        }
                    }
                }
                Tips.init({
                    type: "success",
                    message: "删除成功",
                    class: "on"
                });
                // context.treeData = JSON.parse(JSON.stringify(context.treeData))
                // localStorage.setItem("parentArr",JSON.stringify(context.treeData));
                //console.log(JSON.stringify(context.treeData));
            }
        )
    },

    modifyZzData(context, dataArr, Tips, id) {
        context.$http.patch(zsUrl + '/uc/v1/mgt/dept/' + id + '', dataArr).then(
            function (response) {
                let res = response.data;

                if (context.treeData[0].dept_id == id) { //一级修改
                    //console.log(JSON.stringify(dataArr))
                    context.treeData[0].dept_name = dataArr.dept_name;
                    context.treeData[0].dept_type = dataArr.dept_type;
                    context.treeData[0].area_id = dataArr.area_id;
                    context.treeData = JSON.parse(JSON.stringify(context.treeData))
                    localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                }

                if (context.treeData[0]) { //二级修改
                    for (var a = 0; a < context.treeData[0].children.length; a++) {
                        if (context.treeData[0].children[a].dept_id == id) {
                            context.treeData[0].children[a].dept_name = dataArr.dept_name;
                            context.treeData[0].children[a].dept_type = dataArr.dept_type;
                            context.treeData[0].children[a].area_id = dataArr.area_id;

                            context.treeData = JSON.parse(JSON.stringify(context.treeData))
                            localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                        }
                        if (context.treeData[0].children[a]) { //三级修改

                            for (var b = 0; b < context.treeData[0].children[a].children.length; b++) {

                                if (context.treeData[0].children[a].children[b].dept_id == id) {

                                    context.treeData[0].children[a].children[b].dept_name = dataArr.dept_name;
                                    context.treeData[0].children[a].children[b].dept_type = dataArr.dept_type;
                                    context.treeData[0].children[a].children[b].area_id = dataArr.area_id;
                                    context.treeData = JSON.parse(JSON.stringify(context.treeData))
                                    localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                                }

                                if (context.treeData[0].children[a].children[b]) { //四级修改
                                    for (var c = 0; b < context.treeData[0].children[a].children[b].children.length; c++) { //二级
                                        if (context.treeData[0].children[a].children[b].children[c].dept_id == id) {
                                            context.treeData[0].children[a].children[b].children[c].dept_name = dataArr.dept_name;
                                            context.treeData[0].children[a].children[b].children[c].dept_type = dataArr.dept_type;
                                            context.treeData[0].children[a].children[b].children[c].area_id = dataArr.area_id;
                                            context.treeData = JSON.parse(JSON.stringify(context.treeData))
                                            localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                                        }


                                    }
                                }


                            }
                        }
                    }
                }

                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
            }
        )
    },

    getDeptInfor(context, id, Tips) {
        context.$http.get(zsUrl + '/uc/v1/mgt/dept/' + id + '/staff').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                context.list = res.rows;
                context.total = res.total;
                context.page = [];
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page[i] = i;
                }


            }
        )
    },

    addZzData(context, dataArr, Tips, indexId) {
        context.$http.post(zsUrl + '/uc/v1/mgt/dept', dataArr).then(
            function (response) {

                let res = response.data;

                if (!context.showDept) {
                    context.dept_id = res.data_id;
                    //console.log(res.data_id);
                    localStorage.setItem("data_id", res.data_id);
                    localStorage.setItem("parent_id", res.data_id);
                }

            }
        ).then(
            function () {
                if (!context.showDept) {
                    //console.log("我是第一级")
                    context.$http.get(zsUrl + '/uc/v1/mgt/dept/' + context.dept_id + '').then(
                        function (response) {
                            let
                                res = response.data;
                            res.checked = false;
                            res.indexId = 1
                            context.treeData.push(res);

                            console.log(JSON.stringify(context.treeData));
                            localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                            context.pid = res.dept_id;
                            Tips.init({
                                type: "success",
                                message: "添加成功",
                                class: "on"
                            });
                            if (context.treeData != null) {
                                this.notTree = true;
                                this.notDiv = false;
                            }
                        }
                    )
                } else {
                    //console.log("我是第二级")
                    context.$http.get(zsUrl + '/uc/v1/mgt/dept/' + context.pid + '/node').then(
                        function (response) {
                            let res = response.data;
                            //console.log(JSON.stringify(res))

                            if (indexId == 1) { //一级
                                context.treeData[0].children = [];
                                context.treeData[0].children = context.treeData[0].children.concat(res);
                                for (var i = 0; i < context.treeData[0].children.length; i++) {
                                    context.treeData[0].children[i].checked = false;
                                    context.treeData[0].children[i].indexId = 1 + '-' + i;
                                }

                            }

                            for (var i = 0; i < context.treeData[0].children.length; i++) { //二级
                                if (context.treeData[0].children[i].indexId == indexId) {
                                    context.treeData[0].children[i].children = [];
                                    context.treeData[0].children[i].children = context.treeData[0].children[i].children.concat(res);
                                    for (var j = 0; j < context.treeData[0].children[i].children.length; j++) {
                                        context.treeData[0].children[i].children[j].checked = false;
                                        context.treeData[0].children[i].children[j].indexId = 1 + '-' + i + '-' + j;
                                        console.log(context.treeData[0].children[i].children[j].indexId)

                                    }
                                }

                                if (context.treeData[0].children[i].children) { //三级
                                    for (var j = 0; j < context.treeData[0].children[i].children.length; j++) {
                                        if (context.treeData[0].children[i].children[j].indexId == indexId) {
                                            context.treeData[0].children[i].children[j].children = [];
                                            context.treeData[0].children[i].children[j].children = context.treeData[0].children[i].children[j].children.concat(res);
                                            for (var a = 0; a < context.treeData[0].children[i].children[j].children.length; a++) {
                                                context.treeData[0].children[i].children[j].children[a].checked = false;
                                                context.treeData[0].children[i].children[j].children[a].indexId = 1 + '-' + i + '-' + j + '-' + a;
                                            }
                                        }

                                    }
                                }
                            }

                            context.treeData = JSON.parse(JSON.stringify(context.treeData))
                            localStorage.setItem("parentArr", JSON.stringify(context.treeData));
                        }
                    )
                }


            }
        )
    },

    //平台设置-用户管理
    conGlList(context) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(baseUrl + "/static/data/ptsettings/nrgl/conGlList.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                // console.log(context.pageNum)
                // console.log(context.maxNum)
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page.push(Math.ceil(i));
                }
            }
        )
    },

    //物业管理-用户报修
    yhbx(context) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(baseUrl + "/static/data/wyAdmin/khxt/yhbx.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                // console.log(context.pageNum)
                // console.log(context.maxNum)
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page.push(Math.ceil(i));
                }
            }
        )
    },

    //物业管理-用户报修详情
    yhbxInfor(context) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(baseUrl + "/static/data/wyAdmin/khxt/yhbxInfor.json").then(
            function (response) {
                let res = response.data;
                context.lookInfor = res;
            }
        )
    },

    //物业管理-用户报事
    yhbs(context) {
        // context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area").then(
        context.$http.get(baseUrl + "/static/data/wyAdmin/khxt/yhbs.json").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                context.listLoading = false;
            }
        )
    },

    //分析报表-设备数据
    sbsj(context) {
        context.$http.get("../../static/data/fxReport/sbsj.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                if (res.status == "ok") {
                    context.list = res.datas.jyData;
                    // context.listTj = res.datas.tjData;
                    /*统计图输出*/
                    $('.container').highcharts({
                        chart: {
                            zoomType: 'xy'
                        },
                        title: {
                            text: '2017年多种经营关键数据指标'
                        },
                        legend: {
                            align: 'center',
                            verticalAlign: 'bottom'
                        },
                        xAxis: [{
                            categories: ['2017-8-10', '2017-8-11', '2017-8-12', '2017-8-13', '2017-8-14', '2017-8-15', '2017-8-16'],
                            crosshair: true,
                            labels: {
                                style: {
                                    fontSize: '14px'  //字体
                                }
                            },
                        }],
                        yAxis: [

                            {
                                title: {
                                    text: '',

                                },
                                labels: {
                                    format: '{value}%'

                                },
                                opposite: true
                            },
                            {
                                labels: {
                                    format: '{value}',

                                },
                                title: {
                                    text: '',

                                }
                            }
                        ],
                        credits: {
                            enabled: false  //去掉版权信息
                        },
                        tooltip: {
                            shared: true
                        },

                        series: [
                            {
                                name: '总收入',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData1,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '总支出',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData2,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '利润率',
                                type: 'spline',
                                data: res.datas.tjData3,
                                tooltip: {
                                    valueSuffix: ''
                                }
                            },
                            {
                                name: '满意率',
                                type: 'spline',
                                data: res.datas.tjData4,
                                tooltip: {
                                    valueSuffix: ''
                                }
                            }
                        ]
                    });

                }
                else {
                    alert(res.message)
                }
            }
        )
    },

    //分析报表-报事报修
    bsbx(context) {
        context.$http.get("../../static/data/fxReport/bsbx.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                if (res.status == "ok") {
                    context.list = res.datas.jyData;
                    // context.listTj = res.datas.tjData;
                    /*统计图输出*/
                    /*统计图输出*/
                    $('.container').highcharts({
                        chart: {
                            zoomType: 'xy'
                        },
                        title: {
                            text: '2017年报事报修关键数据指标'
                        },
                        legend: {
                            align: 'center',
                            verticalAlign: 'bottom'
                        },
                        xAxis: [{
                            categories: ['2017-8-10', '2017-8-11', '2017-8-12', '2017-8-13', '2017-8-14', '2017-8-15', '2017-8-16'],
                            crosshair: true,
                            labels: {
                                style: {
                                    fontSize: '14px'  //字体
                                }
                            },
                        }],
                        yAxis: [

                            {
                                title: {
                                    text: '',

                                },
                                labels: {
                                    format: '{value}%',

                                },
                                opposite: true
                            },
                            {
                                labels: {
                                    format: '{value}',

                                },
                                title: {
                                    text: '',

                                }
                            }
                        ],
                        credits: {
                            enabled: false  //去掉版权信息
                        },
                        tooltip: {
                            shared: true
                        },


                        series: [
                            {
                                name: '报修数',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData1,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '报事数',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData2,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '完成率',
                                type: 'spline',
                                data: res.datas.tjData3,
                                tooltip: {
                                    valueSuffix: ''
                                }
                            },
                            {
                                name: '满意率',
                                type: 'spline',
                                data: res.datas.tjData4,
                                tooltip: {
                                    valueSuffix: ''
                                }
                            }
                        ]
                    });

                }
                else {
                    alert(res.message)
                }
            }
        )
    },

    //分析报表-能耗数据
    nhsj(context) {
        context.$http.get("../../static/data/fxReport/nhsj.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                if (res.status == "ok") {
                    context.list = res.datas.jyData;
                    // context.listTj = res.datas.tjData;
                    /*统计图输出*/
                    /*统计图输出*/
                    $('.container').highcharts({
                        chart: {
                            zoomType: 'xy'
                        },
                        title: {
                            text: '2017年能耗关键数据指标'
                        },
                        legend: {
                            align: 'center',
                            verticalAlign: 'bottom'
                        },
                        xAxis: [{
                            categories: ['2017-8-10', '2017-8-11', '2017-8-12', '2017-8-13', '2017-8-14', '2017-8-15', '2017-8-16'],
                            crosshair: true,
                            labels: {
                                style: {
                                    fontSize: '14px'  //字体
                                }
                            },
                        }],
                        yAxis: [

                            {
                                title: {
                                    text: '',

                                },
                                labels: {
                                    format: '{value}%',

                                },
                                opposite: true
                            },
                            {
                                labels: {
                                    format: '{value}',

                                },
                                title: {
                                    text: '',

                                }
                            }
                        ],
                        credits: {
                            enabled: false  //去掉版权信息
                        },
                        tooltip: {
                            shared: true
                        },


                        series: [
                            {
                                name: '用水量',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData1,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '用电量',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData2,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '同比增幅',
                                type: 'spline',
                                data: res.datas.tjData3,
                                tooltip: {
                                    valueSuffix: ''
                                }
                            }
                        ]
                    });

                }
                else {
                    alert(res.message)
                }
            }
        )
    },

    //分析报表-设备及维保数据
    sbjwb(context) {
        context.$http.get("../../static/data/fxReport/sbjwb.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                if (res.status == "ok") {
                    context.list = res.datas.jyData;
                    // context.listTj = res.datas.tjData;


                    /*统计图输出*/
                    $('.container').highcharts({
                        chart: {
                            zoomType: 'xy'
                        },
                        title: {
                            text: '2017年设备及维保关键数据指标'
                        },
                        legend: {
                            align: 'center',
                            verticalAlign: 'bottom'
                        },
                        xAxis: [{
                            categories: ['2017-8-10', '2017-8-11', '2017-8-12', '2017-8-13', '2017-8-14', '2017-8-15', '2017-8-16'],
                            crosshair: true,
                            labels: {
                                style: {
                                    fontSize: '14px'  //字体
                                }
                            },
                        }],
                        yAxis: [

                            {
                                title: {
                                    text: '',

                                },
                                labels: {
                                    format: '{value}%',

                                },
                                opposite: true
                            },
                            {
                                labels: {
                                    format: '{value}',

                                },
                                title: {
                                    text: '',

                                }
                            }
                        ],
                        credits: {
                            enabled: false  //去掉版权信息
                        },
                        tooltip: {
                            shared: true
                        },


                        series: [
                            {
                                name: '设备维保计划数量',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData1,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '完成数量',
                                type: 'column',
                                yAxis: 1,
                                data: res.datas.tjData2,
                                tooltip: {
                                    valueSuffix: ' '
                                }
                            },
                            {
                                name: '逾期率',
                                type: 'spline',
                                data: res.datas.tjData3,
                                tooltip: {
                                    valueSuffix: ''
                                }
                            }
                        ]
                    });

                }
                else {
                    alert(res.message)
                }
            }
        )
    },

    sbwbglNowPag(context, pageArr) {

        context.$http.get(zsUrl + "/device/v1/mgt/device_room_status", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                //console.log(JSON.stringify(context.list));
                context.page_num = res.page_num;
            }
        )
    },

    //物业管理-设备监管-设备运行状态
    sbwbjg(context, pageArr) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/device_room_status").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;

                console.log(JSON.stringify(res))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },

    //平台设置-楼层管理
    yxglNowPag(context, pageArr) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/device_room_status", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num

            }
        )
    },

    //物业管理-设备监管-设备运行状态详情
    sbwbjgInfor(context, id, paraTime) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/device_room/' + id + '/para_status').then(
            function (response) {
                let res = response.data;

                context.list = res;
                for (var i = 0; i < context.list.length; i++) {
                    context.list[i].zcImg = '../../../../../static/images/sbyxzt/icon' + i + '-0.png';
                    context.list[i].gjImg = '../../../../../static/images/sbyxzt/icon' + i + '-1.png';
                    context.list[i].yzgjImg = '../../../../../static/images/sbyxzt/icon' + i + '-2.png';
                    if (context.list[i].para_type == 1) {
                        context.glList.push(context.list[i])
                    }
                    if (context.list[i].para_type == 2) {
                        context.glList.push(context.list[i])
                    }
                    if (context.list[i].para_type == 3) {
                        context.glList.push(context.list[i])
                    }
                    if (context.list[i].para_type == 4) {
                        context.glList.push(context.list[i])
                    }

                }
                console.log(JSON.stringify(context.glList))
            }
        ).then(
            function () {
                context.$http.get(zsUrlSb + '/device/v1/mgt/device_room/para/' + context.list[0].dev_para_id + '/log', {params: paraTime}).then(
                    function (response) {
                        let res = response.data;
                        console.log(JSON.stringify(res))


                    }
                )
            }
        )
    },

    paraTjt(context, dev_para_id, paraTime) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/device_room/para/' + dev_para_id + '/log', {params: paraTime}).then(
            function (response) {
                let res = response.data;
                console.log(JSON.stringify(res))


            }
        )
    },

    //物业管理-设备监管-能耗管理
    nhgl(context) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/public_energy/device_room").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;

                console.log(JSON.stringify(res.rows))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
            }
        )
    },
    getXqList(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/area", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.xqdlist = res.rows;
                console.log(JSON.stringify(res))
            }
        )
    },
    //平台设置-小区管理
    nhglNowPag(context, pageArr) {

        context.$http.get(zsUrlSb + "/device/v1/mgt/public_energy/device_room", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num

            }
        )
    },

    gqNhgl(context) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/public_energy/total").then(
            function (response) {
                let res = response.data;
                console.log(JSON.stringify(res))
                context.quantity = res[0].quantity;
                context.meter = res[0].meter;
                context.quantity1 = res[1].quantity;
                context.meter1 = res[1].meter;
            }
        )
    },

    getInfor(context, id) {
        context.$http.get(zsUrl + '/device/v1/mgt/public_energy_stat/dev_room_id/' + id + '').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                context.getObj = res;

            }
        )
    },

    nhglglNowPag(context, pageArr) {

        context.$http.get(zsUrl + "/device/v1/mgt/public_energy_stat", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                //console.log(JSON.stringify(context.list));
                context.page_num = res.page_num;
            }
        )
    },

    // setSbFz(context,area_id,dataArr) {
    //   context.$http.put(zsUrlSb+'/device/v1/mgt/public_energy/area_id/'+area_id+'/threshold?water_threshold_value='+dataArr.water_threshold_value+'&electricity_threshold_value='+dataArr.electricity_threshold_value+'').then(
    //     function(response){
    //       let res = response.data;
    //       Tips.init({
    //         type:"success",
    //         message:"设置成功",
    //         class:"on"
    //       });
    //     }
    //   )
    // },

    setSbFz(context, area_id, dataArr) {
        context.$http.put(zsUrlSb + '/device/v1/mgt/public_energy/area_id/' + area_id + '/threshold', dataArr).then(
            function (response) {
                let res = response.data;
                Tips.init({
                    type: "success",
                    message: "设置成功",
                    class: "on"
                });
            }
        )
    },

    //物业管理-设备监管-告警日志管理
    gjrz(context) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/alarm_info").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;

                console.log(JSON.stringify(res.rows))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },


    gjrzNowPag(context, pageArr) {

        context.$http.get(zsUrlSb + "/device/v1/mgt/alarm_info", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num

            }
        )
    },


    //物业管理-设备监管-能耗管理
    nhjl(context, dev_room_id, energy_type) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/public_energy/dev_room_id/' + dev_room_id + '/type/' + energy_type + '').then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;

                console.log(JSON.stringify(res))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
            }
        )
    },

    //物业管理-设备监管-能耗管理详情
    nhglInfor(context) {
        context.$http.get("../../static/data/wyAdmin/sbjg/nhglInfor.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(response))
                if (res.status == "ok") {
                    context.list = res.datas;
                }
                else {
                    alert(res.message)
                }
            }
        )
    },
    //物业管理-设备监管-设备基础数据-设备房管理
    sbfgl(context) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/device_room").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                console.log(JSON.stringify(res.rows))
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page[i] = i
                }
            }
        )
    },

    getFjListgl(context, dataArr) {
        context.$http.get(zsUrl + "/uc/v1/mgt/room", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.xqdlist = res.rows;

                //console.log(JSON.stringify(res.rows))
            }
        )
    },

    sbfglPageindex(context, pageArr) {

        context.$http.get(zsUrl + "/device/v1/mgt/device_room", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;

                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
            }
        )
    },


    addSbToSbfData(context, index, id, Tips, pageArr, arrId, dev_ids) {
        // context.$http.delete(zsUrl+'/uc/v1/mgt/cell',{params:arrId}).then(

        context.$http.post(zsUrlSb + '/device/v1/mgt/device_room/' + id + '/device/?dev_ids=' + arrId.dev_ids + '').then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                //console.log(JSON.stringify())


            }
        ).then(
            function () {
                context.$http.get(zsUrlSb + '/device/v1/mgt/device_room/' + id + '').then(
                    function (response) {
                        let res = response.data;
                        context.list = res.dev_infos;
                        context.total = res.total;


                        console.log(JSON.stringify(context.list))

                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "添加成功",
                            class: "on"
                        });

                        context.$router.push({path: '/sbsjList'})

                    }
                )
            }
        )
    },

    modifySbfData(context, index, Tips, dataArr, pageArr, id) {
        context.$http.patch(zsUrl + '/device/v1/mgt/device_room/' + id + '', dataArr).then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res))
                context.$router.push({path: '/sbsjList'})
            }
        )
    },


    pqxq(context) {
        context.$http.get("../../static/data/ptsettings/xqgl/pqxq.json").then(
            function (response) {

                let res = response.data;
                console.log(JSON.stringify(res))
                context.options = res.options;
            }
        )
    },

    pqgl(context) {
        context.$http.get(zsUrl + "/uc/v1/mgt/district").then(
            function (response) {
                let res = response.data;
                console.log(JSON.stringify(res))
                context.pqList = res

            }
        )
    },

    //平台设置-小区管理
    xqgl(context) {
        context.$http.get(zsUrl + "/uc/v1/mgt/area").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.loading = true;
            }
        )
    },


    deleteSbfData(context, index, id, Tips, pageArr) {
        context.$http.delete(zsUrl + '/device/v1/mgt/device_room/' + id + '').then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                //console.log(JSON.stringify())
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/device/v1/mgt/device_room", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);
                        //console.log(JSON.stringify(context.list))
                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }
                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        //console.log(context.pageNum)
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i;

                            //console.log(context.page[i])
                        }
                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    addSbfData(context, dataArr, Tips, pageArr) {
        context.$http.post(zsUrl + '/device/v1/mgt/device_room/', dataArr).then(
            function (response) {
                let res = response.data;

                context.id = res.data_id;
                context.$router.push({path: '/sbsjList'})
            }
        )
    },


    //平台设置-小区管理
    sbfsb(context, id) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/device_room/' + id + '').then(
            function (response) {
                let res = response.data;

                context.dev_room_name = res.dev_room_name;
                context.dev_room_no = res.dev_room_no;
                context.status = res.status;

                context.room_id = res.room_info.id;
                context.dev_room_id = res.room_info.id;
                context.duty_user_id = res.duty_user_info.id;
                context.selectedUser = res.duty_user_info.id;
                context.selected = res.room_info.id;
                context.selectedSbLx = res.dev_room_type;
                context.extra_desc = res.extra_desc;
                context.duty_user = res.duty_user_info.name

                console.log(JSON.stringify(res))

            }
        )
    },

    sbfsbList(context, id) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/device_room/' + id + '').then(
            function (response) {
                let res = response.data;
                context.list = res.dev_infos;
                context.total = res.total;


                console.log(JSON.stringify(context.list))

                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },


    sbfsbL(context, id) { //类型
        context.$http.get('../../static/data/wyAdmin/sbjcsj/lxList.json').then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res.cjcsLx))
                context.sbLxlist = res.sbfLx;
                context.sbList = res.sbLx;
                context.sjlxdlist = res.cjjdsjLx;
                context.jdlxdlist = res.cjjdLx;
                context.cslxdlist = res.cjcsLx;
            }
        )
    },

    // addSbfData(context,dataArr,Tips,pageArr) {
    //   context.$http.post(zsUrl+'/device/v1/mgt/device_room/',dataArr).then(
    //     function(response){
    //       let res = response.data;

    //       context.id = res.data_id;

    //     }
    //   ).then(
    //     function(){
    //        context.$http.get(zsUrl+"/device/v1/mgt/device_room/",{params:pageArr}).then(
    //         function(response){
    //           let res = response.data;
    //           //console.log(JSON.stringify(res.rows))
    //           context.list = res.rows;
    //           context.total = res.total;
    //           context.page = [];
    //           context.page_size = res.page_size;
    //           context.page_num = res.page_num;
    //           context.pageNum = Math.ceil(context.total/context.page_size);

    //           if(context.pageNum<context.maxNum){
    //             context.maxNum = context.pageNum;
    //           }

    //           if(context.list.length==0){
    //             context.showTip = true;
    //           }else{
    //             context.showTip = false;

    //           }
    //           for(var i = 0;i<context.pageNum;i++){
    //             context.page[i] = i
    //           }
    //           /*提示信息*/
    //           Tips.init({
    //             type:"success",
    //             message:"添加成功",
    //             class:"on"
    //           });

    //         }
    //       )
    //     }
    //   )
    // },

    deleteSbfData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/device/v1/mgt/device_room', {params: arrId}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                //console.log(JSON.stringify())
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/device/v1/mgt/device_room", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);
                        //console.log(JSON.stringify(context.list))
                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }
                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        //console.log(context.pageNum)
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i;

                            //console.log(context.page[i])
                        }
                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },


    //物业管理-设备监管-设备基础数据-设备管理
    sbList(context) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/device").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                console.log(JSON.stringify(res.rows))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },

    getSbfListgl(context, dataArr) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/device_room", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.sbflist = res.rows;

                //console.log(JSON.stringify(res.rows))
            }
        )
    },

    addSb(context, dataArr, Tips) {
        context.$http.post(zsUrlSb + "/device/v1/mgt/device/", dataArr).then(
            function (response) {

                Tips.init({
                    type: "success",
                    message: "添加成功",
                    class: "on"
                });
                context.$router.push({path: '/sbgl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    addModifySb(context, dataArr, Tips, device_id) {
        context.$http.patch(zsUrlSb + '/device/v1/mgt/device/' + device_id + '', dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
                context.$router.push({path: '/sbgl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    getModifySb(context, device_id) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/device/' + device_id + '').then(
            function (response) {
                let res = response.data;
                context.dev_name = res.dev_name;
                context.dev_no = res.dev_name;
                context.status = res.status;
                context.mfg_date = res.mfg_date;
                context.exp_date = res.exp_date;
                context.mfg_company = res.mfg_company;
                context.bonus_code = res.bonus_code;
                context.extra_desc = res.extra_desc;
                context.status = res.status;
                context.selectedSbf = res.dev_room_info.id;
                context.selected = res.room_info.id;
                context.selectedLx = res.dev_type;

                context.dev_room_id = res.dev_room_info.id;
                context.rtu_id = res.room_info.id;
                context.sbId = res.dev_type;


                //console.log(JSON.stringify(res))
            }
        )
    },

    sbNowPag(context, pageArr) {

        context.$http.get(zsUrlSb + "/device/v1/mgt/device", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num
                //console.log(JSON.stringify(context.list))


            }
        )
    },


    //物业管理-设备监管-设备基础数据-设备管理
    jksbList(context) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/camera").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                console.log(JSON.stringify(res.rows))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },

    getjksbfListgl(context, dataArr) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/device_room", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.sbflist = res.rows;

                //console.log(JSON.stringify(res.rows))
            }
        )
    },

    addjksb(context, dataArr, Tips) {
        context.$http.post(zsUrlSb + "/device/v1/mgt/camera/", dataArr).then(
            function (response) {

                Tips.init({
                    type: "success",
                    message: "添加成功",
                    class: "on"
                });
                context.$router.push({path: '/jksb'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    addModifyjksb(context, dataArr, Tips, device_id) {
        context.$http.patch(zsUrlSb + '/device/v1/mgt/camera/' + device_id + '', dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
                context.$router.push({path: '/jksb'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    getModifyjksb(context, device_id) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/camera/' + device_id + '').then(
            function (response) {
                let res = response.data;
                context.camera_name = res.camera_name;
                context.camera_no = res.camera_no;
                context.camera_url = res.camera_url;
                context.dev_room_id = res.dev_room_id;
                context.camera_did = res.camera_did;
                context.status = res.status;
                context.extra_desc = res.extra_desc

                context.selectedSbf = res.dev_room_info.id;
                context.dev_room_id = res.dev_room_info.id;
                context.sbname = res.dev_room_info.name;
                console.log(JSON.stringify(res))
            }
        )
    },

    jksbNowPag(context, pageArr) {

        context.$http.get(zsUrlSb + "/device/v1/mgt/camera", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num
                //console.log(JSON.stringify(context.list))


            }
        )
    },


    deleteSbData(context, index, id, Tips, pageArr) {
        context.$http.delete(zsUrl + '/device/v1/mgt/device_room/' + id + '').then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                //console.log(JSON.stringify())
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/device/v1/mgt/device_room", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);
                        //console.log(JSON.stringify(context.list))
                        if (context.pageNum < context.maxNum) {
                            context.maxNum = context.pageNum;
                        }
                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }
                        //console.log(context.pageNum)
                        for (var i = 0; i < context.pageNum; i++) {
                            context.page[i] = i;

                            //console.log(context.page[i])
                        }
                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },


    //物业管理-设备监管-设备基础数据-RTU管理
    rtugl(context) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/rtu').then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;

                console.log(JSON.stringify(res))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },

    getModifyRTU(context, rtu_id) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/rtu/' + rtu_id + '').then(
            function (response) {
                let res = response.data;
                context.rtu_name = res.rtu_name;
                context.rtu_no = res.rtu_no;
                context.room_id = res.room_info.id;
                context.selected = res.room_info.id;

                context.roomName = res.room_info.name;
                context.ip = res.ip;
                context.port = res.port;
                context.status = res.status;
                context.mfg_date = res.mfg_date;
                context.exp_date = res.exp_date;
                context.mfg_company = res.mfg_company;
                context.extra_desc = res.extra_desc;
                console.log(JSON.stringify(res))
            }
        )
    },


    rtuNowPag(context, pageArr) {

        context.$http.get(zsUrlSb + "/device/v1/mgt/rtu", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num


            }
        )
    },

    deleteRtuData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrlSb + '/device/v1/mgt/rtu', {params: arrId}).then(
            //context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area",{params:pageArr}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }


            }
        ).then(
            function () {
                context.$http.get(zsUrlSb + "/uc/v1/mgt/rtu", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);


                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }

                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    addRtu(context, dataArr, Tips) {
        context.$http.post(zsUrlSb + "/device/v1/mgt/rtu/", dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "添加成功",
                    class: "on"
                });
                context.$router.push({path: '/rtugl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    addModifyRtu(context, dataArr, Tips, rtu_id) {
        context.$http.patch(zsUrlSb + '/device/v1/mgt/rtu/' + rtu_id + '', dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
                context.$router.push({path: '/rtugl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },


    //物业管理-设备监管-设备基础数据-RTU管理
    cjjdgl(context) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/collect_node').then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;


                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },

    getRtuListgl(context, dataArr) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/rtu", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.xqdlist = res.rows;

                console.log(JSON.stringify(res.rows))
            }
        )
    },

    getModifyCjjd(context, collect_node_id) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/collect_node/' + collect_node_id + '').then(
            function (response) {
                let res = response.data;
                console.log(JSON.stringify(res))

                context.collect_node_name = res.collect_node_name;
                context.collect_node_no = res.collect_node_no;


                context.collect_node_addr = res.collect_node_addr;
                context.collect_node_brand = res.collect_node_brand;
                context.get_fun = res.get_fun;
                context.collect_node_company = res.collect_node_company;
                context.start_addr = res.start_addr;
                context.start_date = res.start_date;
                context.exp_date = res.exp_date;
                context.status = res.status;
                context.data_len = res.data_len;
                context.extra_desc = res.extra_desc;
                context.rtu_id = res.rtu_info.id;
                context.collect_node_type = res.collect_node_type;
                context.collect_type = res.collect_type
                context.selected = res.rtu_info.id;
                context.selectedjdlx = res.collect_node_type;
                context.selectedsjlx = res.collect_type;

            }
        )
    },


    cjjdNowPag(context, pageArr) {

        context.$http.get(zsUrl + "/device/v1/mgt/collect_node", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num


            }
        )
    },

    deleteCjjdData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/device/v1/mgt/collect_node', {params: arrId}).then(
            //context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area",{params:pageArr}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }


            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/collect_node", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);


                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }

                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    addCjjd(context, dataArr, Tips) {
        context.$http.post(zsUrlSb + "/device/v1/mgt/collect_node", dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "添加成功",
                    class: "on"
                });

                window.localStorage.setItem('lxName', context.lxName)
                window.localStorage.setItem('jdName', context.jdName)


                context.$router.push({path: '/cjjd'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    addModifyCjjd(context, dataArr, Tips, collect_node_id) {
        context.$http.patch(zsUrlSb + '/device/v1/mgt/collect_node/' + collect_node_id + '', dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
                window.localStorage.setItem('lxName', context.lxName)
                window.localStorage.setItem('jdName', context.jdName)
                context.$router.push({path: '/cjjd'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },


    //物业管理-设备监管-设备基础数据-设备参数管理
    sbcsgl(context) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/dev_para').then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;

                console.log(JSON.stringify(res))
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }

            }
        )
    },


    getModifySbcs(context, collect_node_id) {
        context.$http.get(zsUrlSb + '/device/v1/mgt/dev_para/' + collect_node_id + '').then(
            function (response) {
                let res = response.data;
                context.dev_para_name = res.dev_para_name;
                // context.dev_para_no = res.dev_para_no;
                context.rtu_id = res.rtu_id;
                context.collect_type = res.collect_type;
                context.collect_node_addr = res.collect_node_addr;
                context.collect_node_brand = res.collect_node_brand;
                context.collect_node_company = res.collect_node_company;
                context.start_date = res.start_date;
                context.exp_date = res.exp_date;
                context.start_addr = res.start_addr;
                context.extra_desc = res.extra_desc;
                context.data_len = res.data_len;
                context.status = res.status;

                context.dev_para_name = res.dev_para_name;

                context.collect_node_id = res.collect_node_info.id,
                    context.dev_id = res.dev_info.id,
                    context.collect_node_name = res.collect_node_info.name,
                    context.dev_name = res.dev_info.name,
                    context.para_type = res.para_type;
                context.selectedcjjd = res.collect_node_info.id;
                context.selected = res.dev_info.id;
                context.selectedjdlx = res.para_type;

                context.start_addr = res.start_addr;
                context.data_len = res.data_len;
                context.get_fun = res.get_fun;
                context.sensor_code = res.sensor_code;
                context.display_fun = res.display_fun;
                context.bit_operation = res.bit_operation;
                context.status = res.status;
                context.extra_desc = res.extra_desc;
                context.llow_val = res.llow_val;
                context.low_val = res.low_val;
                context.high_val = res.high_val;
                context.hhigh_val = res.hhigh_val;
                context.bool_val = res.bool_val;

                context.llow_level = res.llow_level;
                context.low_level = res.low_level;
                context.high_level = res.high_level;
                context.hhigh_level = res.hhigh_level;
                context.bool_level = res.bool_level;
                context.llow_level = res.llow_level;
                context.low_level = res.low_level;
                context.high_level = res.high_level;
                context.hhigh_level = res.hhigh_level;
                context.bool_level = res.bool_level;

                context.llow_msg = res.llow_msg;
                context.low_msg = res.low_msg;
                context.high_msg = res.high_msg;
                context.hhigh_msg = res.hhigh_msg;
                context.bool_msg = res.bool_msg;
                context.enable_alarm = res.enable_alarm


            }
        )
    },

    getJdListgl(context, dataArr) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/device", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.sblist = res.rows;

                console.log(JSON.stringify(res.rows))
            }
        )
    },


    sssbList(context, dataArr) {
        context.$http.get(zsUrlSb + "/device/v1/mgt/collect_node", {params: dataArr}).then(
            function (response) {
                let res = response.data;
                context.xqdlistcjjd = res.rows;

                console.log(JSON.stringify(res.rows))
            }
        )
    },

    sbcsNowPag(context, pageArr) {

        context.$http.get(zsUrlSb + "/device/v1/mgt/dev_para", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;

                context.currentPage = pageArr.page_num


            }
        )
    },

    deleteSbcsData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrlSb + '/device/v1/mgt/dev_para', {params: arrId}).then(
            //context.$http.get("http://192.168.1.178:8080/uc/v1/mgt/area",{params:pageArr}).then(
            function (response) {
                let res = response.data;
                //context.list.splice(index, 1);
                if (context.list.length == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }


            }
        ).then(
            function () {
                context.$http.get(zsUrlSb + "/uc/v1/mgt/collect_node", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;
                        context.page_num = res.page_num;
                        context.pageNum = Math.ceil(context.total / context.page_size);


                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }

                        //console.log(JSON.stringify(context.page))
                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },

    addSbcs(context, dataArr, Tips) {
        context.$http.post(zsUrlSb + "/device/v1/mgt/dev_para", dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "添加成功",
                    class: "on"
                });
                //context.$router.push({path:'/sbcsgl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },

    addModifySbcs(context, dataArr, Tips, collect_node_id) {
        context.$http.patch(zsUrlSb + '/device/v1/mgt/dev_para/' + collect_node_id + '', dataArr).then(
            function (response) {
                Tips.init({
                    type: "success",
                    message: "修改成功",
                    class: "on"
                });
                context.$router.push({path: '/sbcsgl'})
            },
            function (err) {

                alert(err.body.error_msg)
            }
        )
    },


    //物业管理-设备监管-设备基础数据-计划模板管理
    wbjhmbgl(context) {
        context.$http.get("../../static/data/wyAdmin/wbrw/wbjhmb.json").then(
            // context.$http.get(zsUrlSb+"/maintenanceplan/v1/mgt/mp_template").then(
            function (response) {
                let res = response.data;
                console.log(JSON.stringify(res))
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.loading = false;
            }
        )
    },

    jhmbglNowPag(context, pageArr) {

        context.$http.get(zsUrlSb + "/maintenanceplan/v1/mgt/mp_template", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;
                context.currentPage = pageArr.page_num;

            }
        )
    },

    //物业管理-设备监管-设备基础数据-计划模板管理-检查项列表
    jhmbglList(context) {
        context.$http.get("../../static/data/wyAdmin/sbjcsj/wbrw/jhmbglList.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                // console.log(context.pageNum)
                // console.log(context.maxNum)
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page.push(Math.ceil(i));
                }
            }
        )
    },

    //物业管理-设备监管-设备基础数据-维保任务管理
    wbjhgl(context) {
        context.$http.get("../../static/data/wyAdmin/sbjcsj/wbrw/wbjhgl.json").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);

                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page.push(Math.ceil(i));
                }
            }
        )
    },

    //物业管理-设备监管-设备基础数据-维保任务管理-检查项列表
    wbjhglInfor(context) {
        context.$http.get("../../static/data/wyAdmin/sbjcsj/wbrw/wbjhglInfor.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                // console.log(context.pageNum)
                // console.log(context.maxNum)
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page.push(Math.ceil(i));
                }
            }
        )
    },

    //物业管理-维保任务管理-维保任务管理
    wbrwgl(context) {
        context.$http.get("../../static/data/wyAdmin/wbrw/wbjhgl.json").then(
            function (response) {
                let res = response.data;
                console.log(res)
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                context.loading = false;
            }
        )
    },

    wbrwgljc(context) {
        context.$http.get("../../static/data/wyAdmin/wbrw/wbrwgljc.json").then(
            function (response) {
                let res = response.data;
                console.log(res)
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                context.loading = true;
            }
        )
    },

    //物业管理-设备监管-设备基础数据-维保任务管理-检查项列表
    wbrwglInfor(context) {
        context.$http.get("../../static/data/wyAdmin/sbjcsj/wbrw/wbrwglInfor.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                // console.log(context.pageNum)
                // console.log(context.maxNum)
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    //context.page.push(Math.ceil(i));
                }
            }
        )
    },


    jsgl(context) {
        context.$http.get(zsUrl + "/uc/v1/mgt/role").then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;


                context.loading = true;
            }
        )
    },

    xqglNowPag(context, pageArr) {

        context.$http.get(zsUrl + "/uc/v1/mgt/role", {params: pageArr}).then(
            function (response) {
                let res = response.data;
                context.list = res.rows;
                context.total = res.total;
                context.page_num = pageArr.page_num;
                context.page_size = res.page_size;
                //console.log(pageArr.page_num)
                context.currentPage = pageArr.page_num;
                context.loading = true;

            }
        )
    },

    nhjlglNowPag(context, pageArr) {

        context.$http.get(zsUrl + "/device/v1/mgt/public_energy_stat", {params: pageArr}).then(
            function (response) {

                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                //console.log(JSON.stringify(context.list));
                context.page_num = res.page_num;
            }
        )
    },

    deleteJsData(context, index, Tips, pageArr, arrId) {
        context.$http.delete(zsUrl + '/uc/v1/mgt/role', {params: arrId}).then(
            function (response) {
                let res = response.data;

            }
        ).then(
            function () {
                context.$http.get(zsUrl + "/uc/v1/mgt/role", {params: pageArr}).then(
                    function (response) {
                        let res = response.data;
                        context.list = res.rows;
                        context.total = res.total;
                        context.page = [];
                        context.page_size = res.page_size;

                        if (context.list.length == 0) {
                            context.showTip = true;
                        } else {
                            context.showTip = false;
                        }


                        /*提示信息*/
                        Tips.init({
                            type: "success",
                            message: "删除成功",
                            class: "on"
                        });

                    }
                )
            }
        )
    },


    xtpd(context) {
        context.$http.get("../../static/data/wyAdmin/khxt/xtpd.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);

                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page.push(Math.ceil(i));
                }
            }
        )
    },

    // login:function(context,pageArr){
    //   context.$http.post(''+zsUrl+'/uc/v1/login',pageArr).then(
    //     function(response){
    //       let res = response.data;
    //       console.log(JSON.stringify(res));

    //       window.localStorage.setItem('id_token', res.access_token)
    //       window.localStorage.setItem('x-area-id', "1")
    //       context.$router.push({ path: '/home'})
    //     }


    //   )
    // },

    login: function (context, pageArr) {
        context.$http.post('http://192.168.1.100/uc/v1/login', pageArr).then(
            function (response) {
                let res = response.data;
                console.log(JSON.stringify(res));
                $(".page-sidebar-wrapper,.page-header,.page-footer").removeClass("hide");
                $(".r").addClass("page-container").removeClass("r");
                $(".r1").addClass("page-content-wrapper").removeClass("r1");

                $(".r2").addClass("page-content").removeClass("r2");
                window.localStorage.setItem('id_token', res.access_token)
                window.localStorage.setItem('x-area-id', "1")
                context.$router.push({path: '/home'})
            }
        )
    },

    //物业管理-app标签管理
    appBqgl(context) {
        context.$http.get("../../static/data/ptsettings/appBqgl.json").then(
            function (response) {
                let res = response.data;
                //console.log(JSON.stringify(res));
                context.list = res.rows;
                context.total = res.total;
                context.page_size = res.page_size;
                context.page_num = res.page_num;
                context.pageNum = Math.ceil(context.total / context.page_size);
                // console.log(context.pageNum)
                // console.log(context.maxNum)
                if (context.pageNum < context.maxNum) {
                    context.maxNum = context.pageNum;
                }
                if (context.total == 0) {
                    context.showTip = true;
                } else {
                    context.showTip = false;
                }
                for (var i = 0; i < context.pageNum; i++) {
                    context.page.push(Math.ceil(i));
                }
            }
        )
    },

}

